<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta http-equiv="pragma" content="no-cache" />
	<meta http-equiv="expires" content="-1" />
	<link rel="stylesheet" type="text/css" href="/site_media/css/style.css" />
	<script type="text/javascript" src="/site_media/js/script.js"></script>
	<title>Labmin - grupy studentów</title>
</head>
<body>
	<div id="wrap">
		{% include "header.html" %}
		{% if request.session.user %}
			<div id="content-wrap">
				{% include "sidebar.html" %}
				<div id="main">
					<div class="box">
                		<h1>Grupy <span class="gray">studentów</span></h1>
					</div>
					<div class="padded_box">
						<input class="button" type="button" value="Pokaż wszystkie" onclick="window.location='/student_groups_list?show=all'">
						<input class="button" type="button" value="Pokaż tylko moje" onclick="window.location='/student_groups_list'">
					</div>
					
                    {% include "pagination.html" %}
					
                    <div class="box">
						<form name="form" action="/delete_student_group" method="post">
						<input type="hidden" id="student_group_pk_input" name="student_group_pk" value="" />
                        <table class="list_table">
                        {% for student_group in objects.object_list %}
							<script type="text/javascript">
									function showStudentsOfGroup{{ student_group.pk }}() {
										setSpanDescription('show_hide_group_{{ student_group.pk }}', "Ukryj studentów");
										clearAndShowDiv('students_of_group{{ student_group.pk }}');
                                		{% for student in student_group.students.all %}
										addStudentToDiv('students_of_group{{ student_group.pk }}', {{ student.pk }}, '{{ student.login }}', '{{ student.email }}')
										{% endfor %}
										surroundItemsWithULTag('students_of_group{{ student_group.pk }}');
									}
									function hideStudentsOfGroup{{ student_group.pk }}() {
										setSpanDescription('show_hide_group_{{ student_group.pk }}', "Pokaż studentów");
										hideDiv('students_of_group{{ student_group.pk }}');
									}
									function switchShowAndHideStudentsOfGroup{{ student_group.pk }}() {
										if (document.getElementById('show_hide_group_{{ student_group.pk }}').innerHTML == "Pokaż studentów") {
											showStudentsOfGroup{{ student_group.pk }}();
										} else {
											hideStudentsOfGroup{{ student_group.pk }}();
										}
									}
							</script>
							<tr>
                                <td><a href="show_student_group/{{ student_group.pk }}"><b>{{ student_group.name }}</b></a></td>
								<td>{{ student_group.description }}</td>
								<td><a href="#" onclick="switchShowAndHideStudentsOfGroup{{ student_group.pk }}()"><span id="show_hide_group_{{ student_group.pk }}">Pokaż studentów</span></a></td>
								<td><a href="student_group_form/{{ student_group.pk }}">Edytuj</a></td>
								<td><a href="#" onclick="setHiddenValueAndSubmit('student_group_pk_input', '{{student_group.pk}}')">Usuń</a></td>
							</tr>
							<tr>
								<td colspan="5"><div id="students_of_group{{ student_group.pk }}" class="box" style="display:none"></div></td>
							</tr>
                        {% endfor %}
                        </table>
                    </div>
                    
                    {% include "pagination.html" %}
					
				</div>
			</div>
		{%endif%}
	</div>
	{% include "footer.html" %}
</body>
</html>
